/**

This file is part of MaCI/GIMnet.

MaCI/GIMnet is free software: you can redistribute it and/or modify it 
under the terms of the GNU Lesser General Public License as published 
by the Free Software Foundation, either version 3 of the License, or 
(at your option) any later version.

MaCI/GIMnet is distributed in the hope that it will be useful, but WITHOUT 
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public 
License for more details.

You should have received a copy of the GNU Lesser General Public 
License along with GIMnet. (See COPYING.LESSER) If not, see 
<http://www.gnu.org/licenses/>.

**/
/**
 *
 * \file
 * \brief Conversion from YUYV to RGB dataformat.
 * \author Antti Maula <antti.maula@tkk.fi>
 */
#ifndef _IMAGEUTILS_CONVERSIONS_YUYV_TO_RGB_H_
#define _IMAGEUTILS_CONVERSIONS_YUYV_TO_RGB_H_

#include <inttypes.h>

#ifdef __cplusplus
extern "C" {
#endif

  /** Convert from YUYV (aka. YUY2) to RGB.
   *
   * This function converts given buffer, which is assumed to be in
   * YUYV format, and to contain enough data into a RGB buffer, which
   * is also assumed to be big enough to contain the result.
   *
   * Expected datasizes are (2*width*height) for YUYV, and
   * (3*widht*height) for RGB.
   *
   * The function returns no value, as the conversion is blind. If you
   * give invalid parameters or invalid data, the code will probably
   * cause a SegFault (or other severe problems). So be careful.
   *
   * @param[out] output Pointer to output buffer (must be big enough
   * to hold the output (== width*height*3)
   * @param[in] input Input data containing the YUYV format data. Size
   * must be width*height*2 (two pixels per 4bytes)
   * @param[in] width Width of the image in pixels.
   * @param[in] height Height of the image in pixels.
   */
  void conversion_YUYV_to_RGB(uint8_t *output, const uint8_t *input,
                              int width, int height);


#ifdef __cplusplus
}
#endif

#endif
